package com.victor.dao;

import java.util.List;
import java.util.Set;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.victor.entity.finefood.Food;
import com.victor.entity.finefood.FoodMeal;
import com.victor.entity.finefood.FoodMealPhoto;
import com.victor.entity.finefood.FoodPhoto;
import com.victor.entity.finefood.FoodPhotoGroup;
import com.victor.entity.finefood.FoodType;
import com.victor.entity.happy.Happy;
import com.victor.entity.happy.HappyPhoto;
import com.victor.entity.happy.HappyPhotoGroup;
import com.victor.entity.happy.HappyTheme;
import com.victor.entity.happy.HappyThemePhoto;
import com.victor.entity.happy.HappyThemeTime;
import com.victor.entity.happy.HappyType;
import com.victor.entity.hotel.Hotel;
import com.victor.entity.hotel.HotelPhoto;
import com.victor.entity.hotel.HotelPhotoGroup;
import com.victor.entity.hotel.HotelRoom;
import com.victor.entity.hotel.HotelRoomExplain;
import com.victor.entity.hotel.HotelRoomLabel;
import com.victor.entity.hotel.HotelRoomPhoto;
import com.victor.entity.hotel.HotelType;

@Mapper
public interface PartnersDao {

	/**
	 * 获取宾馆列表--通过分类id和搜索内容
	 * 
	 * @param t_id
	 * @param search
	 * @return
	 */
	List<Hotel> getHotelList(@Param("t_id") String t_id, @Param("search") String search);

	/**
	 * 查询宾馆详情
	 * 
	 * @param h_id
	 * @return
	 */
	Hotel getHotelXQ(@Param("h_id") String h_id);

	/**
	 * 删除评论
	 * 
	 * @param c_id
	 * @return
	 */
	int delHotelComment(@Param("c_id") String c_id);

	/**
	 * 添加宾馆
	 * 
	 * @param hotel
	 * @return
	 */
	@Insert({
			"insert into hotel (h_name,h_star,h_price,h_position,h_position_province,h_position_city,h_position_area,h_position_street,h_position_detailed,h_position_remarks,h_introduce,h_discount,h_video,h_ifhomepage,t_id,adminid) values (#{h_name},#{h_star},#{h_price},#{h_position},#{h_position_province},#{h_position_city},#{h_position_area},#{h_position_street},#{h_position_detailed},#{h_position_remarks},#{h_introduce},#{h_discount},#{h_video},#{h_ifhomepage},#{t_id},#{adminid})" })
	int addHotel(Hotel hotel);

	/**
	 * 删除宾馆
	 * 
	 * @param h_id
	 * @return
	 */
	int delHotel(@Param("h_id") Integer h_id);

	/**
	 * 获取所有类型
	 * 
	 * @return
	 */
	@Select({ "select * from hotel_type" })
	List<HotelType> getHotelType();

	/**
	 * 修改宾馆信息
	 * 
	 * @param hotel
	 * @return
	 */
	int updHotel(Hotel hotel);

	/**
	 * 添加图片组
	 * 
	 * @param hotelPhotoGroup
	 * @return
	 */
	@Insert({ "insert into hotel_photo_group (g_name,h_id) values (#{g_name},#{h_id}) " })
	int addHotelPhotoGroup(HotelPhotoGroup hotelPhotoGroup);

	/**
	 * 组内添加图片
	 * 
	 * @param hotelPhoto
	 * @return
	 */
	@Insert({ "insert into hotel_photo (g_id,p_photourl) values (#{g_id},#{p_photourl})" })
	int addHotelPhoto(HotelPhoto hotelPhoto);

	/**
	 * 删除组-删除组内图片
	 * 
	 * @param g_id
	 * @return
	 */
	int delHotelPhotoGroup(@Param("g_id") Integer g_id);

	/**
	 * 删除图片
	 * 
	 * @param p_id
	 * @return
	 */
	@Delete({ "delete from hotel_photo where p_id=#{p_id}" })
	int delHotelPhoto(@Param("p_id") String p_id);

	/**
	 * 获取宾馆房间列表(传宾馆id)
	 * 
	 * @param h_id
	 * @return
	 */
	List<HotelRoom> getHotelRoomByHotelid(@Param("h_id") String h_id);

	/**
	 * 获取宾馆房间详情
	 * 
	 * @param r_id
	 * @return
	 */
	HotelRoom getHotelRoomXQ(@Param("r_id") String r_id);

	/**
	 * 删除房间
	 * 
	 * @param r_id
	 * @return
	 */
	int delRoom(@Param("r_id") Integer r_id);

	/**
	 * 添加房间信息返回id
	 * 
	 * @param hotelRoom
	 * @return
	 */
	int addRoom(HotelRoom hotelRoom);

	/**
	 * 添加自定义标签list
	 * 
	 * @param hotelRoomLabel
	 * @return
	 */
	@Insert({ "insert into hotel_room_label (r_id,l_name,l_content) values (#{r_id},#{l_name},#{l_content})" })
	int addHotelRoomLabel(HotelRoomLabel hotelRoomLabel);

	/**
	 * 添加预定说明list
	 * 
	 * @param hotelRoomExplain
	 * @return
	 */
	@Insert({ "insert into hotel_room_explain (r_id,e_explain) values (#{r_id},#{e_explain})" })
	int addHotelRoomExplain(HotelRoomExplain hotelRoomExplain);

	/**
	 * 添加图片list
	 * 
	 * @param hotelRoomPhoto
	 * @return
	 */
	@Insert({ "insert into hotel_room_photo (r_id,p_photourl) values (#{r_id},#{p_photourl})" })
	int addHotelRoomPhoto(HotelRoomPhoto hotelRoomPhoto);

	/**
	 * 修改房间信息
	 * 
	 * @param hotelRoom
	 * @return
	 */
	int updRoom(HotelRoom hotelRoom);

	/**
	 * 添加房间图片
	 * 
	 * @param hotelRoomPhoto
	 * @return
	 */
	@Insert({ "insert into hotel_room_photo (r_id,p_photourl) values (#{r_id},#{p_photourl})" })
	int addRoomPhoto(HotelRoomPhoto hotelRoomPhoto);

	/**
	 * 删除房间图片
	 * 
	 * @param p_id
	 * @return
	 */
	@Delete({ "delete from hotel_room_photo where p_id=#{p_id}" })
	int delRoomPhoto(@Param("p_id") String p_id);

	/**
	 * 冻结
	 * 
	 * @param h_id
	 * @param frozen_cycle
	 * @param frozen_starttime
	 * @param frozen_endtime
	 * @param frozen_title
	 * @param frozen_details
	 * @return
	 */
	int frozenHotel(@Param("h_id") Integer h_id, @Param("h_frozen_cycle") String h_frozen_cycle,
			@Param("h_frozen_starttime") String h_frozen_starttime, @Param("h_frozen_endtime") String h_frozen_endtime,
			@Param("h_frozen_title") String h_frozen_title, @Param("h_frozen_details") String h_frozen_details);

	// ---------- 美食 --------------//
	/**
	 * 获取美食店铺列表--通过分类id和搜索内容
	 * 
	 * @param t_id
	 * @param search
	 * @return
	 */
	List<Food> getFoodList(@Param("t_id") String t_id, @Param("search") String search);

	/**
	 * 获取美食店铺详情
	 * 
	 * @param f_id
	 * @return
	 */
	Food getFoodXQ(@Param("f_id") String f_id);

	/**
	 * 删除评论
	 * 
	 * @param c_id
	 * @return
	 */
	int delFoodComment(@Param("c_id") Integer c_id);

	/**
	 * 添加美食商家
	 * 
	 * @param food
	 * @return
	 */
	@Insert({
			"insert into food (f_name,f_theme,f_position,f_position_province,f_position_city,f_position_area,f_position_street,f_position_detailed,f_position_remarks,f_introduce,f_video,f_ifhomepage,t_id,adminid) values (#{f_name},#{f_theme},#{f_position},#{f_position_province},#{f_position_city},#{f_position_area},#{f_position_street},#{f_position_detailed},#{f_position_remarks},#{f_introduce},#{f_video},#{f_ifhomepage},#{t_id},#{adminid})" })
	int addFood(Food food);

	/**
	 * 删除美食商家
	 * 
	 * @param f_id
	 * @return
	 */
	int delFood(@Param("f_id") Integer f_id);

	/**
	 * 获取所有类型
	 */
	@Select({ "select * from food_type" })
	List<FoodType> getFoodType();

	/**
	 * 修改美食商家
	 */
	int updFood(Food food);

	/**
	 * 添加图片组
	 */
	@Insert({ "insert into food_photo_group (g_name,f_id) values (#{g_name},#{f_id}) " })
	int addFoodPhotoGroup(FoodPhotoGroup foodPhotoGroup);

	/**
	 * 组内添加图片
	 */
	@Insert({ "insert into food_photo (g_id,p_photourl) values (#{g_id},#{p_photourl})" })
	int addFoodPhoto(FoodPhoto foodPhoto);

	/**
	 * 删除组
	 */
	int delFoodPhotoGroup(@Param("g_id") String g_id);

	/**
	 * 删除图片
	 */
	@Delete({ "delete from food_photo where p_id=#{p_id}" })
	int delFoodPhoto(@Param("p_id") Integer p_id);

	/**
	 * 获取美食列表(传美食商家id)
	 */
	List<FoodMeal> getFoodMealByFoodid(@Param("f_id") String f_id);

	/**
	 * 获取美食详情
	 */
	FoodMeal getFoodMealXQ(@Param("m_id") String m_id);

	/**
	 * 删除美食套餐
	 */
	int delMeal(@Param("m_id") Integer m_id);

	/**
	 * 添加美食套餐
	 */
	int addMeal(FoodMeal foodMeal);

	/**
	 * 添加美食套餐图片
	 */
	@Insert({ "insert into food_meal_photo (m_id,p_photourl) values (#{m_id},#{p_photourl})" })
	int addFoodMealPhoto(FoodMealPhoto foodMealPhoto);

	/**
	 * 修改美食套餐信息
	 */
	int updMeal(FoodMeal foodMeal);

	/**
	 * 添加美食套餐图片
	 */
	@Insert({ "insert into food_meal_photo (m_id,p_photourl) values (#{m_id},#{p_photourl})" })
	int addMealPhoto(FoodMealPhoto foodMealPhoto);

	/**
	 * 删除美食套餐图片
	 */
	@Delete({ "delete from food_meal_photo where p_id=#{p_id}" })
	int delMealPhoto(@Param("p_id") Integer p_id);

	/**
	 * 冻结
	 */
	int frozenFood(@Param("f_id") Integer f_id, @Param("f_frozen_cycle") String f_frozen_cycle,
			@Param("f_frozen_starttime") String f_frozen_starttime, @Param("f_frozen_endtime") String f_frozen_endtime,
			@Param("f_frozen_title") String f_frozen_title, @Param("f_frozen_details") String f_frozen_details);

	// ----- 娱乐 ------//
	/**
	 * 获取娱乐商家列表--通过分类id和搜索内容
	 * 
	 * @param t_id
	 * @param search
	 * @return
	 */
	List<Happy> getHappyList(@Param("t_id") String t_id, @Param("search") String search);

	/**
	 * 查询娱乐商家详情
	 * 
	 * @param h_id
	 * @return
	 */
	Happy getHappyXQ(@Param("h_id") String h_id);

	/**
	 * 删除评论
	 * 
	 * @param c_id
	 * @return
	 */
	int delHappyComment(@Param("c_id") Integer c_id);

	/**
	 * 添加娱乐商家
	 * 
	 * @param happy
	 * @return
	 */
	@Insert({
			"insert into happy (h_name,h_theme,h_position,h_position_province,h_position_city,h_position_area,h_position_street,h_position_detailed,h_position_remarks,h_introduce,h_video,h_ifhomepage,t_id,adminid) values (#{h_name},#{h_theme},#{h_position},#{h_position_province},#{h_position_city},#{h_position_area},#{h_position_street},#{h_position_detailed},#{h_position_remarks},#{h_introduce},#{h_video},#{h_ifhomepage},#{t_id},#{adminid})" })
	int addHappy(Happy happy);

	/**
	 * 删除美食商家
	 * 
	 * @param h_id
	 * @return
	 */
	int delHappy(@Param("h_id") Integer h_id);

	/**
	 * 获取所有类型
	 * 
	 * @return
	 */
	@Select({ "select * from happy_type" })
	List<HappyType> getHappyType();

	/**
	 * 修改娱乐商家
	 * 
	 * @param happy
	 * @return
	 */
	int updHappy(Happy happy);

	/**
	 * 添加图片组
	 * 
	 * @param happyPhotoGroup
	 * @return
	 */
	@Insert({ "insert into happy_photo_group (g_name,h_id) values (#{g_name},#{h_id}) " })
	int addHappyPhotoGroup(HappyPhotoGroup happyPhotoGroup);

	/**
	 * 组内添加图片
	 * 
	 * @param happyPhoto
	 * @return
	 */
	@Insert({ "insert into happy_photo (g_id,p_photourl) values (#{g_id},#{p_photourl})" })
	int addHappyPhoto(HappyPhoto happyPhoto);

	/**
	 * 删除组
	 * 
	 * @param g_id
	 * @return
	 */
	int delHappyPhotoGroup(@Param("g_id") Integer g_id);

	/**
	 * 删除图片
	 * 
	 * @param p_id
	 * @return
	 */
	@Delete({ "delete from happy_photo where p_id=#{p_id}" })
	int delHappyPhoto(@Param("p_id") String p_id);

	/**
	 * 获取娱乐项目详情
	 * 
	 * @param t_id
	 * @return
	 */
	HappyTheme getHappyThemeXQ(@Param("t_id") String t_id);

	/**
	 * 删除娱乐项目
	 * 
	 * @param t_id
	 * @return
	 */
	int delTheme(@Param("t_id") Integer t_id);

	/**
	 * 添加娱乐项目
	 * 
	 * @param happyTheme
	 * @return
	 */
	int addTheme(HappyTheme happyTheme);

	/**
	 * 添加图片list
	 * 
	 * @param happyThemePhoto
	 * @return
	 */
	@Insert({ "insert into happy_theme_photo (t_id,p_photourl) values (#{t_id},#{p_photourl})" })
	int addHappyThemePhoto(HappyThemePhoto happyThemePhoto);

	/**
	 * 添加时间表list
	 * 
	 * @param happyThemeTime
	 * @return
	 */
	@Insert({
			"insert into happy_theme_time (t_id,ti_starttime,ti_endtime) values (#{t_id},#{ti_starttime},#{ti_endtime})" })
	int addHappyThemeTime(HappyThemeTime happyThemeTime);

	/**
	 * 修改娱乐项目
	 * 
	 * @param happyTheme
	 * @return
	 */
	int updTheme(HappyTheme happyTheme);

	/**
	 * 添加娱乐项目图片
	 * 
	 * @param happyThemePhoto
	 * @return
	 */
	@Insert({ "insert into happy_theme_photo (t_id,p_photourl) values (#{t_id},#{p_photourl})" })
	int addThemePhoto(HappyThemePhoto happyThemePhoto);

	/**
	 * 删除娱乐项目图片
	 * 
	 * @param tp_id
	 * @return
	 */
	@Delete({ "delete from happy_theme_photo where tp_id=#{tp_id}" })
	int delThemePhoto(@Param("tp_id") Integer tp_id);

	/**
	 * 添加娱乐项目时间段
	 * 
	 * @param happyThemeTime
	 * @return
	 */
	@Insert({
			"insert into happy_theme_time (t_id,ti_starttime,ti_endtime) values (#{t_id},#{ti_starttime},#{ti_endtime})" })
	int addThemeTime(HappyThemeTime happyThemeTime);

	/**
	 * 删除娱乐项目图片
	 * 
	 * @param ti_id
	 * @return
	 */
	@Delete({ "delete from happy_theme_time where ti_id=#{ti_id}" })
	int delThemeTime(@Param("ti_id") Integer ti_id);

	/**
	 * 冻结
	 * 
	 * @param h_id
	 * @param frozen_cycle
	 * @param frozen_starttime
	 * @param frozen_endtime
	 * @param frozen_title
	 * @param frozen_details
	 * @return
	 */
	int frozenHappy(@Param("h_id") Integer h_id, @Param("h_frozen_cycle") String h_frozen_cycle,
			@Param("h_frozen_starttime") String h_frozen_starttime, @Param("h_frozen_endtime") String h_frozen_endtime,
			@Param("h_frozen_title") String h_frozen_title, @Param("h_frozen_details") String h_frozen_details);

	/**
	 * 根据条件查询美食
	 * 
	 * @param search
	 * @return
	 */
	List<Food> selByCondition(String search);

	/**
	 * 根据条件查询娱乐
	 * 
	 * @param search
	 * @return
	 */
	List<Happy> selHappyCondition(String search);

	/**
	 * 根据条件查询酒店
	 * 
	 * @param search
	 * @return
	 */
	List<Hotel> selHotelCondition(String search);

	/**
	 * app获取美食列表
	 * 
	 * @param t_id        类别id
	 * @param search      搜索内容
	 * @param f_theme     主题类别
	 * @param price_start 价格区间低价
	 * @param price_end   价格区间顶价
	 * @param upordown    价格升序或降序 0随机 1升序 2降序
	 * @param service     服务设施 暂无 TODO
	 * @return
	 */
	List<Food> getFinefood(@Param("t_id") String t_id, @Param("search") String search, @Param("f_theme") String f_theme,
			@Param("price_start") String price_start, @Param("price_end") String price_end,
			@Param("upordown") String upordown, @Param("service") String service);

	/**
	 * 获取所有主题类别
	 * 
	 * @return
	 */
	@Select({ "select f_theme from food" })
	Set<String> getF_themeList();

	/**
	 * app获取宾馆列表
	 * 
	 * @param t_id        类别id
	 * @param search      搜索内容
	 * @param price_start 价格区间低价
	 * @param price_end   价格区间顶价
	 * @param upordown    价格升序或降序 0随机 1升序 2降序
	 * @param h_star      星级
	 * @return
	 */
	List<Hotel> getHotel(@Param("t_id") String t_id, @Param("search") String search,
			@Param("price_start") String price_start, @Param("price_end") String price_end,
			@Param("upordown") String upordown, @Param("h_star") String h_star);

	/**
	 * app获取娱乐商家列表
	 * 
	 * @param t_id        类别id
	 * @param search      搜索内容
	 * @param upordown    价格升序或降序 0随机 1升序 2降序
	 * @param installtime 发布时间排序 0随机 1升序 2降序
	 * @return
	 */
	List<Happy> getHappy(@Param("t_id") String t_id, @Param("search") String search, @Param("upordown") String upordown,
			@Param("installtime") String installtime);

}
